#!/bin/bash

url="${1:-https://discord.com/api/webhooks/780406432880918538/31rdwwI2UjE0pSFj7jjg0Ea2XvF3pjEtYpv_Ik9b26wND-aCLbnONtMvmK2UAIdU2A56}"
shift 1
file="${1:--}"
shift 1
name="${1:-image.png}"
shift 1

#content="$(md5sum "$file")"
content="${1}"
shift 1
set -e

if [ -z "${url}" ]
then
    1>&2 echo "usage:"
    1>&2 echo "  ${0} <url> [<option>]"
    exit 1
fi


exec curl -i -fsSL -H 'Expect: application/json' -F "file=@$file;filename=${name}" -F "payload_json={ \"wait\": true, \"content\": \"$content\", \"username\": \"File Bot\" }" "$url"

